home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d949.lha / BBBBS / BBBBS65.lha / rexx / bbsDoors.rexx < prev    next >
OS/2 REXX Batch file  |  1993-09-17  |  5KB  |  224 lines

  1. /* $VER: bbsDoors.rexx 6.3 (17.9.93)
  2. Originally called Jump.rexx by Matt English 9-30-92
  3. Alterations by Richard Lee Stockton 5 Aug 93, 17 Sep 93
  4.  
  5. This is a utility for BBBBS sysops to use rexxDoors offline.
  6. FREELY DISTRIBUTABLE as long as no-one makes any money on it,
  7. this notice remains, and the credits at the main menu remain.
  8. */
  9.  
  10. OPTIONS FAILAT 999999
  11.  
  12. /* Open the support library if it is not already open. */
  13. if ~show('L',"rexxsupport.library") THEN
  14.     CALL addlib('rexxsupport.library',0,-30,0)
  15.  
  16. if ~showlist('p','QuickSortPort') then do
  17.    ADDRESS COMMAND "run quicksort >NIL:"
  18.    do i=1 to 10
  19.       if ~showlist('p','QuickSortPort') then CALL delay 20
  20.       else leave i
  21.    END
  22.    if showlist('p','QuickSortPort') then CALL addlib('QuickSortPort',-30)   
  23. END
  24.  
  25. name=''
  26. figarg='s:CONFIG.BBS'
  27. IF ~EXISTS(figarg) THEN figarg='BBS:BBS_TEXT/CONFIG.BBS'
  28. x=OPEN(f,figarg,'R')
  29. IF x=0 THEN
  30.   DO
  31.     SAY 's:CONFIG.BBS and BBS:BBS/CONFIG.BBS are both missing!'
  32.     EXIT(20)
  33.   END
  34. lynes.=''
  35. DO i=1 TO 6
  36.   lynes.i=READLN(f)
  37. END
  38. CALL CLOSE(f)
  39.  
  40. compos=POS('/*',lynes.1)
  41. IF compos>0 THEN lynes.1=LEFT(lynes.1,compos-1)
  42. bbsname=STRIP(lynes.1)
  43. sysop  =WORD(lynes.2,1)
  44. bbspath=WORD(lynes.6,1)
  45. IF ~EXISTS(bbspath) THEN
  46.   DO
  47.     SAY bbspath 'does not exist!'
  48.     CALL SETCLIP('BBS_STAT')
  49.     EXIT(20)
  50.   END
  51. testchar=RIGHT(bbspath,1)
  52. IF testchar~='/' & testchar~=':' THEN bbspath=bbspath'/'
  53. CALL SETCLIP('BBS_path',bbspath)
  54. CALL PRAGMA('D',bbspath'rexxDoors')
  55.  
  56. def='';  /* default */
  57. pen0='';  pen1='';  pen2='';  pen3=''
  58. pen4='';  pen5='';  pen6='';  pen7=''
  59. bak0='';  bak1='';  bak2='';  bak3=''
  60. bak4='';  bak5='';  bak6='';  bak7=''
  61.  
  62. SAY
  63. SAY'                       bbsDoors.rexx'
  64. SAY'               Original by Matt English 9-30-92'
  65. SAY'       Alterations for BBBBS 6.3 by RLS 9-17-93'
  66. SAY
  67. SAY
  68. options prompt' Are you 'sysop' ? Y or n > '
  69. pull answer
  70. if answer='Y' | answer='' then name=sysop
  71. else DO
  72.   SAY
  73.   options prompt' Please enter your name > '
  74.   pull response
  75.   response=strip(upper(response))
  76.   response=translate(response,'_',' ')
  77.   if response='' then CALL bye
  78.   file=bbspath'lists/Users'
  79.   CALL open(list,file,'r')
  80.   match=0
  81.   do until match=1
  82.    nameline=readln(list)
  83.    if eof(list) then do
  84.     CALL close(list)
  85.     CALL ok
  86.     END
  87.    do i=1 to 3
  88.     testname=word(nameline,i)
  89.     if testname=response then do
  90.      name=response
  91.      match=1
  92.      END
  93.     if testname='' then iterate
  94.     END
  95.    END
  96. END
  97.  
  98. OK:
  99. SAY
  100. if match=0 then
  101.   DO
  102.     SAY' I can''t find you on the users list!'
  103.     SAY' You should log on to the BBS before you try this!'
  104.     CALL delay(100)
  105.     CALL bye
  106.   END
  107.  
  108. userfile=bbspath'Users/'name
  109. CALL open(data,userfile,'r')
  110. DO i=1 TO 18
  111.   line=readln(data)
  112.   IF i=5 THEN password=WORD(line,1)
  113. END
  114. CALL close(data)
  115. winnings=WORD(line,1)
  116. IF ~DATATYPE(winnings,'N') THEN winnings=0
  117.  
  118. passprompt=' 'pen3'Please Enter Password: '
  119. DO tries=1 TO 3
  120.   OPTIONS PROMPT passprompt
  121.   PULL newpassword
  122.   SAY ''
  123.   IF(password=newpassword) THEN LEAVE tries; /* correct password */
  124.   IF tries=3 THEN
  125.     DO
  126.       SAY 
  127.       SAY 'Access terminated.'
  128.       line='*** Bad password ***' newpassword '***'
  129.       SAY line
  130.       CALL bye
  131.     END
  132.   passprompt='Incorrect.  Password: ' /* ask again */
  133. END
  134. SAY
  135. SAY' OK, 'name' here we go....'
  136. SAY
  137.  
  138. CALL sortdoors()
  139. temp=1
  140. readcount=-1
  141. DO doorloop=1
  142.   IF temp=0 THEN
  143.     DO
  144.       IF readcount~=-1 THEN
  145.         DO
  146.           doors.0=''
  147.           CALL sortdoors()
  148.         END
  149.       SAY
  150.       SAY CENTER('- Number of accesses per file -',75)
  151.     END
  152.   SAY pen3||LEFT('-',75,'-')||def
  153.   DO jd=1 TO jdoors.0
  154.     IF temp=0 THEN SAY jdoors.jd.0
  155.     ELSE SAY jdoors.jd
  156.   END
  157.   IF temp=0 THEN
  158.     DO
  159.       SAY
  160.       OPTIONS PROMPT '                                 'pen3'Press RETURN 'def
  161.       PULL junk
  162.       temp=1
  163.       SAY
  164.       ITERATE doorloop
  165.     END
  166.   options prompt' 'pen3'Select Application Number (0=Stats) or hit 'pen2'Return to Quit' pen3'> 'def
  167.   pull temp
  168.   IF temp=0 THEN ITERATE doorloop
  169.   IF ~DATATYPE(temp,'N') | temp<1 | temp>doors.0 THEN RETURN
  170.   arg=doors.temp
  171.   IF GETCLIP('BBS_door')=arg THEN
  172.     DO
  173.       SAY 'That door is in use!  Try again in a few minutes...'
  174.       ITERATE doorloop
  175.     END
  176.   CALL SETCLIP('BBS_localdoor',arg)
  177.   readcount=WORD(STATEF(bbspath'rexxDoors/'arg),8)
  178.   IF ~DATATYPE(readcount,'W') THEN readcount=0
  179.   ADDRESS COMMAND 'C:filenote' bbspath'rexxDoors/'arg readcount+1
  180.   comm='CALL' doors.temp'('name winnings 0 1 6000')'
  181.   INTERPRET comm
  182.   CALL SETCLIP('BBS_localdoor')
  183. END
  184.  
  185. bye:
  186. CALL SETCLIP('BBS_localdoor')
  187. SAY
  188. SAY' Now leaving bbsDoors....'
  189. SAY
  190. EXIT
  191.  
  192.  
  193. sortdoors:
  194. IF ~DATATYPE(jdoors.0,'W') THEN doors.0=0
  195. IF WORDS(SHOWDIR(bbspath'rexxDoors','F'))~=doors.0 THEN
  196.   DO
  197.     jdoors.=''
  198.     doorlist=SHOWDIR(bbspath'rexxDoors','F')
  199.     doors.=''
  200.     doors.0=WORDS(doorlist)
  201.     DO i=1 TO doors.0
  202.       doors.i=WORD(doorlist,i)
  203.     END
  204.     SAY 'Sorting..'
  205.     CALL QSORT(1,doors.0,doors)
  206.     jdoors.0=doors.0%3
  207.     IF (doors.0//3)>0 THEN jdoors.0=jdoors.0+1
  208.     DO i=1 TO jdoors.0
  209.       DO j=0 TO 2
  210.         k=i+j*jdoors.0
  211.         IF k<=doors.0 THEN
  212.           DO
  213.             jdoors.i=jdoors.i' 'LEFT(RIGHT(k,3)'.' LEFT(doors.k,LENGTH(doors.k)-5),24)
  214.             dcount=WORD(STATEF(bbspath'rexxDoors/'doors.k),8)
  215.             jdoors.i.0=jdoors.i.0||LEFT(RIGHT(dcount,5) LEFT(doors.k,LENGTH(doors.k)-5),24)' '
  216.           END
  217.       END
  218.     END
  219.   END
  220. RETURN 0
  221.  
  222.  
  223. /* bbsDoors.rexx */
  224.